const { defineConfig } = require("@vue/cli-service");
const webpack = require("webpack");
const NodePolyfillPlugin = require("node-polyfill-webpack-plugin");
module.exports = defineConfig({
  transpileDependencies: true,
  lintOnSave: false,
  chainWebpack: (config) => {
    config.module
      .rule("vue")
      .use("vue-loader")
      .tap((options) => {
        options.compilerOptions = {
          ...(options.compilerOptions || {}),
          isCustomElement: (tag) => tag.startsWith("your-prefix-"),
        };
        return options;
      });
  },
  configureWebpack: {
    plugins: [new NodePolyfillPlugin()],
    // resolve: {
    //   fallback: {
    //     process: require.resolve("process"),
    //   },
    // },
    // resolve: {
    //   extensions: [".js", ".vue", ".json"],
    //   modules: [path.resolve(__dirname, "src"), "node_modules"],
    // },
  },
  devServer: {
    proxy: {
      "/api": {
        target: "http://localhost:8989",
        ws: true,
        changeOrigin: true, //允许跨域
        pathRewrite: {
          "^/api": "",
        },
      },
      "/webrtc": {
        target: "http://192.168.40.130:1985",//"192.168.40.130:8000",//"http://192.168.112.128:1985", //"http://192.168.8.1:1985",
        ws: true,
        changeOrigin: true, //允许跨域
        pathRewrite: {
          "^/webrtc": "",
        },
      },
    },
  },
});
